package com.zenjava.jfx.performance.animate1;

import javafx.animation.Animation;
import javafx.animation.ScaleTransition;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.util.Duration;

public class TextAnimateApp extends Application {

    public static void main(String[] args) throws Exception {
        launch(args);
    }

    public void start(Stage stage) throws Exception {

        final StackPane rootPane = new StackPane();

        Label label = new Label("This is a label");
        label.setStyle("-fx-font-scale: 30");
        ScaleTransition scale = new ScaleTransition(Duration.seconds(5), label);
        scale.setCycleCount(Animation.INDEFINITE);
        scale.setAutoReverse(true);
        scale.setFromX(0);
        scale.setFromY(0);
        scale.setToX(5);
        scale.setToY(5);
        scale.play();
        rootPane.getChildren().add(label);

        Scene scene = new Scene(rootPane, 1200, 800);
        stage.setScene(scene);
        stage.show();
    }
}
